class Test:
    def __init__(self, v: int):
        self._v = v

    @property
    def v(self):
        return self._v

    def __lt__(self, other):
        return self._v < other.v

    def __le__(self, other):
        return self._v <= other.v

    def __ne__(self, other):
        return self._v != other.v

    def __eq__(self, other):
        return self._v == other.v

    def __gt__(self, other):
        return self._v > other.v

    def __ge__(self, other):
        return self._v >= other.v


# t1 = Test(8)
# t2 = Test(8)
# t3 = Test(10)
# li = [t1, t2, t3]
# print(max(li).v)
# print(min(li).v)


def hello():
    print("Hello world")
#
#
# class Mc:
#     def __init__(self, integer):
#         self.value = integer
#
#     def m_print(self):
#         print(self.value)
#
#
# m = Mc(12)
# from threading import Timer
from time import sleep
#
# Timer(5, m.m_print).start()
# sleep(2)
# m.value = 20
# sleep(6)
from threading import Thread, Event


class LTimer(Thread):
    """Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    """

    def __init__(self, interval, function, args=None, kwargs=None):
        Thread.__init__(self)
        self.interval = interval
        self.function = function
        self.args = args if args is not None else []
        self.kwargs = kwargs if kwargs is not None else {}
        self.finished = Event()

    def cancel(self):
        """Stop the timer if it hasn't finished yet."""
        self.finished.set()

    def run(self):
        while True:
            self.finished.wait(self.interval)
            if not self.finished.is_set():
                self.function(*self.args, **self.kwargs)
            else:
                self.finished.set()
                break

t = None

def self_stop():
    t.cancel()

t = LTimer(2, self_stop)

t.start()
sleep(7)